from google.appengine.ext import db

class Language(db.Model):
    '''
    our language model
    '''
    name = db.TextProperty()
    locale_id = db.CategoryProperty()
    default = db.BooleanProperty()

class Size(db.Model):
    '''
    our language model
    '''
    name = db.CategoryProperty()
    width = db.IntegerProperty()
    default = db.BooleanProperty()

class Settings(db.Model):
    '''
    our settings model
    '''
    language = db.ReferenceProperty(Language)
    wiki = db.TextProperty()
    author = db.TextProperty()
    collection = db.TextProperty()
    exposition = db.TextProperty()
    picture = db.TextProperty()
    contact = db.TextProperty()
    start = db.TextProperty()
    end = db.TextProperty()
    select = db.TextProperty()

class Category(db.Model):
    '''
    our category database
    '''
    language = db.ReferenceProperty(Language)
    title = db.CategoryProperty()
    position = db.IntegerProperty()

class Wiki(db.Model):
    '''
    our page database
    '''
    language = db.ReferenceProperty(Language)
    category = db.ReferenceProperty(Category)
    title = db.CategoryProperty()
    content = db.TextProperty()
    html_content = db.TextProperty()
    position = db.IntegerProperty()

class Author(db.Model):
    '''
    our author database
    '''
    language = db.ReferenceProperty(Language)
    last_name = db.CategoryProperty()
    first_name = db.CategoryProperty()
    info = db.TextProperty()
    html_info = db.TextProperty()

class Collection(db.Model):
    '''
    our collection database
    '''
    language = db.ReferenceProperty(Language)
    title = db.CategoryProperty()
    info = db.TextProperty()
    html_info = db.TextProperty()

class Exposition(db.Model):
    '''
    our exposition database
    '''
    language = db.ReferenceProperty(Language)
    title = db.CategoryProperty()
    date_start = db.DateTimeProperty()
    date_end = db.DateTimeProperty()
    info = db.TextProperty()
    html_info = db.TextProperty()

class Picture(db.Model):
    '''
    our picture database
    '''
    language = db.ReferenceProperty(Language)
    title = db.CategoryProperty()
    info = db.TextProperty()
    html_info = db.TextProperty()
    author = db.ReferenceProperty(Author)
    collection = db.ReferenceProperty(Collection)
    exposition = db.ReferenceProperty(Exposition)
    url = db.CategoryProperty()

class Contact(db.Model):
    '''
    our contact model
    '''
    language = db.ReferenceProperty(Language)
    info = db.TextProperty()
    html_info = db.TextProperty()

class Game(db.Model):
    name = db.CategoryProperty()

class Score(db.Model):
    #
    one = db.IntegerProperty()
    two = db.IntegerProperty()
    three = db.IntegerProperty()
    four = db.IntegerProperty()
    five = db.IntegerProperty()
    six = db.IntegerProperty()
    #
    total_one = db.IntegerProperty()
    #
    three_of_kind = db.IntegerProperty()
    four_of_kind = db.IntegerProperty()
    full = db.IntegerProperty()
    small_suite = db.IntegerProperty()
    big_suite = db.IntegerProperty()
    lucky = db.IntegerProperty()
    yams = db.IntegerProperty()
    #
    total_two = db.IntegerProperty()
    #
    total_all = db.IntegerProperty()

class Player(db.Model):
    game = db.ReferenceProperty(Game)
    score = db.ReferenceProperty(Score)
    name = db.CategoryProperty()

class Dice(db.Model):
    player = db.ReferenceProperty(Player)
    name = db.CategoryProperty()
    turn = db.IntegerProperty()
    value = db.IntegerProperty()
    selected = db.BooleanProperty()
